require('./bootstrap.js');
// Vue
window.Vue = require('vue').default;


// vue-cookie
Vue.use(require('vue-cookie'));


// vue-progressbar 进度条
import VueProgressBar from 'vue-progressbar'
// 注册 vue-progressbar
Vue.use(VueProgressBar);


// simplebar 滚动条
import VueSimplebar from 'vue-simplebar'
// 通过[resources/sass/app.scss]引入 css
// import 'vue-simplebar/dist/vue-simplebar.min.css'
// 注册 simplebar
Vue.use(VueSimplebar, {options: {autoHide: false}})


// vue-i18n 国际化
import VueI18n from 'vue-i18n';
// element-ui
import ElementUI from 'element-ui';
import enLocale from 'element-ui/lib/locale/lang/en';
import zhLocale from 'element-ui/lib/locale/lang/zh-CN';

// 通过[resources/sass/app.scss]引入 css
// import 'element-ui/lib/theme-chalk/index.css';
// 创建 VueI18n 实例
const i18n = new VueI18n({
    locale: Vue.prototype.$cookie.get('lang') || 'zh-CN',
    messages: {
        'en': Object.assign(require(`./lang/en`).default, enLocale),
        'zh-CN': Object.assign(require(`./lang/zh-CN`).default, zhLocale)
    }
});
// 添加 Vue 私有属性
Vue.prototype.$lang = function (key) {
    return i18n.t(key);
};
// element-ui 国际化
Vue.use(ElementUI, {i18n: (key, value) => i18n.t(key, value)});


// font-awesome
import {library} from '@fortawesome/fontawesome-svg-core';
import {fas} from '@fortawesome/free-solid-svg-icons';
import {far} from '@fortawesome/free-regular-svg-icons';
import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome';
// 注册字体
library.add(fas);
library.add(far);
Vue.component('font-awesome-icon', FontAwesomeIcon);


// 引入 vue-numeral-filter 数字格式化
import numeralFilter from 'vue-numeral-filter';
// 注册 vue-numeral-filter
Vue.use(numeralFilter);


// 公共组件
Vue.component('component-layout-breadcrumb', require('./components/layout/Breadcrumb.vue').default);
Vue.component('component-layout-server', require('./components/layout/Server.vue').default);
Vue.component('component-layout-menu', require('./components/layout/Menu.vue').default);
Vue.component('component-layout-org', require('./components/layout/Org.vue').default);
Vue.component('component-layout-user', require('./components/layout/User.vue').default);
Vue.component('component-layout-timezone', require('./components/layout/Timezones.vue').default);
Vue.component('component-layout-document', require('./components/layout/Document.vue').default);
Vue.component('component-page-tree', require('./components/page/tree/Index.vue').default);
Vue.component('component-page-loading', require('./components/page/Loading.vue').default);
Vue.component('component-page-timestamp', require('./components/page/Timestamp.vue').default);
Vue.component('component-page-numeral', require('./components/page/Numeral.vue').default);
Vue.component('component-page-games', require('./components/page/game/Games.vue').default);
Vue.component('component-page-game-option', require('./components/page/game/GameOption.vue').default);
Vue.component('component-page-model-option', require('./components/page/model/Option.vue').default);
Vue.component('component-page-model-view', require('./components/page/model/View.vue').default);
Vue.component('component-page-ratio-option', require('./components/page/ratio/Option.vue').default);
Vue.component('component-page-ratio-view', require('./components/page/ratio/View.vue').default);
Vue.component('component-page-org-tree', require('./components/page/org/Tree.vue').default);
Vue.component('component-page-org-tree-option', require('./components/page/org/TreeOption.vue').default);
Vue.component('component-page-org-tree-option-check', require('./components/page/org/TreeOptionCheck.vue').default);
Vue.component('component-page-date-picker-day', require('./components/page/DatePickerDay.vue').default);
Vue.component('component-page-echarts', require('./components/page/Echarts.vue').default);
Vue.component('component-page-summary', require('./components/page/Summary.vue').default);
Vue.component('component-page-content-resize', require('./components/page/ContentResize.vue').default);
Vue.component('component-page-option-top-stats', require('./components/page/option/TopStats.vue').default);
Vue.component('component-page-option-field-range', require('./components/page/option/FieldRange.vue').default);
Vue.component('component-page-option-currency', require('./components/page/option/Currency.vue').default);
Vue.component('component-page-option-top', require('./components/page/option/Top.vue').default);
Vue.component('component-page-option-datetime', require('./components/page/option/Datetime.vue').default);
Vue.component('component-page-option-datetime-range', require('./components/page/option/DatetimeRange.vue').default);
Vue.component('component-page-selection-dictionary', require('./components/page/selection/Dictionary.vue').default);
Vue.component('component-page-selection-users', require('./components/page/selection/Users.vue').default);
Vue.component('component-page-selection-user', require('./components/page/selection/User.vue').default);

// 引入 filter 公共过滤库
require('./utils/filter.js');
// 引入 helper 公共函数库
require('./utils/helper.js');

// 根 App.vue
import App from './App.vue';
// 路由 router
import router from './router/index.js';
// 状态管理 Vuex
import store from './store'

const app = new Vue({
    el: '#app',
    router,
    store,
    i18n,
    render: h => h(App)
});
